<template>
  <!-- 每日推荐 -->
  <div class="dailyRecom">
    <div class="dailyinfo">
      <div class="img-wrap">
        <div class="day">30</div>
      </div>
      <div class="text">
        <div class="font-24 font-bold">每日歌曲推荐</div>
        <div class="font-12 grey">根据你的音乐口味生成，每天6:00更新</div>
      </div>
    </div>
    <div class="btn-wrap">
      <button class="btn btn-red">播放全部</button>
      <button class="btn">收藏全部</button>
    </div>
    <songs-list :songs="dailySongs"></songs-list>
  </div>
</template>

<script>
import SongsList from '@/components/SongsList/songsList.vue'
import { getDailyRecomSongs } from '@/api/personalized.js'
export default {
  data () {
    return {
      // 日推歌曲
      dailySongs: []
    }
  },
  created () {
    // 展示日推歌曲
    this.showDailyRecomSongs()
  },
  components: {
    SongsList
  },
  methods: {
    // 获取日推歌曲
    async showDailyRecomSongs () {
      const res = await getDailyRecomSongs(this.$store.state.cookie)
      if (res.data.code !== 200) return this.$message.error('获取日推歌曲失败')
      this.dailySongs = res.data.data.dailySongs
    }
  }
}
</script>

<style lang="less" scoped>
.dailyinfo {
  display: flex;
}
.img-wrap {
  width: 100px;
  height: 100px;
  background: url('https://cdn.jsdelivr.net/gh/dingwanren/myImgCDN/calendar.png') no-repeat;
  background-position: 0 0;
  background-size: 100%;
  .day {
    width: 100px;
    height: 40px;
    margin-top: 30px;
    font-size: 40px;
    font-weight: bold;
    color: #ec4141;
  }
}
.text {
  display: flex;
  flex-direction: column;
  text-align: left;
  margin-top: 20px;
  margin-left: 30px;
}
.btn-wrap {
  display: flex;
}
</style>
